home *** CD-ROM | disk | FTP | other *** search
/ FM Towns: Free Software Collection 8 / FM Towns Free Software Collection 8.iso / t_os / wtv / wtv.c < prev    next >
Text File  |  1994-06-01  |  3KB  |  154 lines

  1. /* TV  ワイド 化 */
  2.  
  3. #include <egb.h>
  4. #include <mos.h>
  5. #include <stdio.h>
  6. #include <stdlib.h>
  7. #include <conio.h>
  8. #include <string.h>
  9. #include <dos.h>
  10. #include "Platform.h"
  11. #include "aoi_lib2.h"
  12.  
  13.  
  14. void wtv(int pORG, int pSCR)
  15. {
  16.     int        y, t;
  17.     char    p0[360 * 2];
  18.     char    p1[360 * 2];
  19.     char    p2[360 * 120 * 2];
  20.     
  21.     for (y = 0, t = 30; y < 60; y += 2, t++) {
  22.         EGB_writePage(work, pORG);
  23.         AOIgetGraph(p0, 0, y, 360, y);
  24.         AOIgetGraph(p1, 0, y + 180, 360, y + 180);
  25.         EGB_writePage(work, pSCR);
  26.         AOIputGraph(p0, 0, t, 360, t);
  27.         if (!((t + 150) > 208)) {
  28.             AOIputGraph(p1, 0, t + 150, 360, t + 150);
  29.         }
  30.     }
  31.     EGB_writePage(work, pORG);
  32.     AOIgetGraph(p2, 0, 60, 360, 180);
  33.     EGB_writePage(work, pSCR);
  34.     AOIputGraph(p2, 0, 60, 360, 180);
  35. }
  36.  
  37. void wtv1(int pORG, int pSCR)
  38. {
  39.     int        y, t;
  40.     char    p0[360 * 2];
  41.     char    p1[360 * 2];
  42.     char    p2[360 * 120 * 2];
  43.     
  44.     for (y = 0, t = 30; y < 60; y += 2, t++) {
  45.         EGB_writePage(work, pORG);
  46.         AOIgetGraph(p0, 0, y, 360, y);
  47.         AOIgetGraph(p1, 0, y + 180, 360, y + 180);
  48.         EGB_writePage(work, pSCR);
  49.         AOIputGraph(p0, 0, t, 360, t);
  50.         if (!((t + 150) > 208)) {
  51.             AOIputGraph(p1, 0, t + 150, 360, t + 150);
  52.         }
  53.     }
  54. }
  55.  
  56. void wtv3(int pORG, int pSCR)
  57. {
  58.     char    *p;
  59.     
  60.     p = (char *)malloc(360 * 180 * 2 * sizeof(char));
  61.     if (p == NULL) return;
  62.     
  63.     EGB_writePage(work, pORG);
  64.     AOIgetGraph(p, 0, 30, 360, 210);
  65.     EGB_writePage(work, pSCR);
  66.     AOIputGraph(p, 0, 30, 360, 210);
  67.     free(p);
  68. }
  69.  
  70. void wtv2(int pORG, int pSCR)
  71. {
  72.     int        a, b;
  73.     char    *p;
  74.  
  75.  
  76.     p = (char *)malloc(360 * 240 * 2 * sizeof(char));
  77.  
  78.     EGB_writePage(work, pORG);
  79.     AOIgetGraph(p, 0, 0, 360, 240);
  80.  
  81.     EGB_writePage(work, pSCR);
  82.     for (a = 1083, b = 2888; a < 173280; a += 722) {
  83.         memcpy(p + a, p + b, 720);
  84.         b += 1444;
  85.     }
  86.     AOIputGraph(p, 0, 60, 360, 120 + 60);
  87. }
  88.  
  89. void main(void)
  90. {
  91.     int        endMark = 0;
  92.     int        ch, x, y;
  93.     int        mode = 0;
  94.     int        oldMode = 0;
  95.     
  96.     MOS_start(mwork, 4096);
  97.     EGB_init(work, 1536);
  98.     EGB_resolution(work, 0, 9);
  99.     EGB_resolution(work, 1, 9);
  100.  
  101.     EGB_displayPage(work, 0, 1);
  102.     
  103.     EGB_superImpose(work, 65);
  104.     EGB_writePage(work, 1);
  105.     EGB_digitize(work, 1);
  106.  
  107.     do {
  108.         MOS_rdpos(&ch, &x, &y);
  109.         switch (ch) {
  110.             case 1 :
  111.                 mode++;
  112.                 if (mode == 3) mode = 0;
  113.                 break;
  114.             case 2 :
  115.                 endMark = 1;
  116.                 break;
  117.         }
  118.         do {MOS_rdpos(&ch, &x, &y);} while (ch);    //    一端マウスボタンを離さないと受け付けない
  119.         switch (mode) {
  120.             case 0 :    //    縦圧縮
  121.                 if (oldMode != mode) {
  122.                     EGB_displayPage(work, 0, 1);
  123.                     oldMode = mode;
  124.                 }
  125.                 wtv(1, 0);
  126.                 break;
  127.             case 1 :    //    縦圧縮 2
  128.                 if (oldMode != mode) {
  129.                     EGB_displayPage(work, 0, 3);
  130.                     EGB_writePage(work, 0);
  131.                     EGB_writeMode(work, 10);
  132.                     AOIboxFull(0, 60, 360, 180, 0xffffffff);
  133.                     EGB_writeMode(work, 0);
  134.                     oldMode = mode;
  135.                 }
  136.                 wtv1(1, 0);
  137.                 break;
  138.             case 2 :    //    黒幕挿入
  139.                 if (oldMode != mode) {
  140.                     EGB_displayPage(work, 0, 3);
  141.                     EGB_writePage(work, 0);
  142.                     EGB_writeMode(work, 10);
  143.                     AOIboxFull(0, 30, 360, 208, 0xffffffff);
  144.                     EGB_writeMode(work, 0);
  145.                     oldMode = mode;
  146.                 }
  147.                 break;
  148.         }
  149.         if (kbhit()) endMark = 1;
  150.     } while (endMark != 1);
  151.  
  152.     MOS_end();
  153. }
  154.